﻿function Show()
    {
       if(($("sl2").style.display==""&&$("sl3").style.display=="")||($("sl2").style.display==""&&$("sl4").style.display=="")||$("sl4").style.display==""&&$("sl3").style.display=="")
            {
                $("TLanShow").style.display="none";
            }
            if($("sl2").style.display=="none")
            {
                $("sl2").style.display="";
            }
            else if($("sl2").style.display==""&&$("sl3").style.display=="none")
            {
                $("sl3").style.display="";
            }
            else if($("sl2").style.display==""&&$("sl3").style.display==""&&$("sl4").style.display=="none")
            {
                $("sl4").style.display="";
            }
    }
    function del()
    { 
    $("TLanShow").style.display="";
        var j=0;
       for(var i=1 ;i<5;i++)
       {
        if($("sl"+i).style.display=="none")
        {
        
           j=i-1; $("sl"+j).style.display="none";
           $("TLang"+j).value="";
           break;
        }
            if(i==4&&j==0)
            {
                $("TLang4").value="";
                $("sl4").style.display="none";
            }
       }
    }
function getTlevel(a,b)
{
var level="";
    for(var i=0;i<4;i++)
    {
    if($(a+i).checked&&$(b).value!="")
    {
       level+=""+$(a+i).value;
    }
        
    }
    return level;
}

function Tpstep()
{

if(TT_c!="")
{
Week=TT_c;
fromTime=TT_d;
ToTime=TT_e;
}
$('SWeek').style.display='none';
if(!$ValidButton$()||Week==""){
if(Week=="")
{
    $('SWeek').style.display='';
}
return;

}

showProgressBar(true);
var TLang1Level=getTlevel('T1Le','TLang1');
var TLang2Level=getTlevel('T2Le','TLang2');
var TLang3Level=getTlevel('T3Le','TLang3');
var TLang4Level=getTlevel('T4Le','TLang4');
var FreeTrial=false;
var   timezone   =   new   Date();   
timezone=-timezone.getTimezoneOffset();
if($('FreeTrial1').checked)
{
  FreeTrial=true;
}
 WebServices.User.Teach.AddTeachProfile($('TeacherType').value, $('TLang1').value, TLang1Level, $('TLang2').value, TLang2Level, $('TLang3').value,
             TLang3Level, $('TLang4').value, TLang4Level, $('TeachExper').value,  $('Price').value, FreeTrial, "", "-", "",
             "-",  "-",  "1",  false,  "",  "", Week, fromTime, ToTime, timezone,onners);   
}
function onners(reft)
{
showProgressBar(false);
if(reft)
{
      top.location="/invite_teach/Tpstep2.htm";
}else
{
$get("MessagesBox").style.display='';
}

}
